import React, { useState } from 'react'
import { Image, Linking, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
import icon_unselected from '../../../assets/icon_unselected.png';
import icon_selected from '../../../assets/icon_selected.png';

export default function AgreementCom(props: { check: boolean; changeCheck: any }) {
  const {check , changeCheck} = props
  return (
    <View style={styles.root}>
      <TouchableOpacity onPress={changeCheck}>
        <Image style={styles.radio_icon} source={check ? icon_selected : icon_unselected} />
      </TouchableOpacity>
      <Text style={styles.lableTxt}>我已阅读并同意</Text>
      <TouchableOpacity
        onPress={() => {
          Linking.openURL('https://www.baidu.com')
        }}
      >
        <Text style={styles.agreementTxt}>《用户协议》和《隐私政策》</Text>
      </TouchableOpacity>
    </View>
  )
}
const styles = StyleSheet.create({
  root: {
    flexDirection: 'row',
    justifyContent: 'center',
    alignItems:'center',
    position: 'absolute',
    bottom: 30,
    lineHeight: 20
  },
  radioButton: {

  },
  radio_icon: {
    width: 20,
    height: 20,
  },
  lableTxt: {
    fontSize: 12,
    color: '#999',
    marginLeft: 6,
  },
  agreementTxt: {
    fontSize: 12,
    color: '#333'
  }
})